<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div class="app">
        <h2>去掉空格</h2>
        <input type="text" v-model="msg">
        <p>{{msgCom}}</p>
        <hr>
        <h2>添加价格后缀</h2>
        <input type="text" v-model:Number="msg2">
        <p>{{msg2Com}}</p>
    </div>
    <script>
        new Vue({
            el:".app",
            data(){
                return {
                    msg:'',
                    msg2:''
                }
            },
            computed:{
                msgCom(){
                    return this.msg.trim();
                },
                msg2Com(){
                    if(!this.msg2)return;
                    return Number(this.msg2).toFixed(2) + '元'
                }
            }
        })
    </script>
</body>
</html>